package net.whg.java.bytetype;

import net.whg.java.abstrac.Circle;
import net.whg.java.abstrac.CircleList;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

public class ByteTest {


    public static void main(String[] args) {
        //List<String> list = null;
        //String collect = list.stream().collect(Collectors.joining(","));


        Byte a = (byte)100;
        if (a.toString().equals("100")){
            System.out.println(true);
        }
        //System.out.println(a.toString());


        //getImageCountFromTxtFile("2020-07-01_09:09:09_101.txt");

        List<CircleList> list = new ArrayList<>();
        List<Circle> circleList1 = new ArrayList<>();
        List<Circle> circleList2 = new ArrayList<>();
        circleList1.add(new Circle(10));
        circleList1.add(new Circle(20));
        circleList1.add(new Circle(30));
        circleList2.add(new Circle(40));
        circleList2.add(new Circle(50));
        circleList2.add(new Circle(60));
        list.add(new CircleList(circleList1));
        list.add(new CircleList(circleList2));
        List<Double> list1 =list.stream().flatMap(obj -> obj.getList().stream()).map(Circle::getRadius).collect(Collectors.toList());
        list1.forEach(System.out::println);
    }

    public static void getImageCountFromTxtFile(String txtFileName) {
        Pattern pattern = Pattern.compile("(\\d)+-(\\d)+-\\d+_\\d+:\\d+:\\d+_(\\d+)\\.txt");
        Matcher matcher = pattern.matcher(txtFileName);

        if (!matcher.find()) {
            System.out.println("错误");
        }
        String countString = matcher.group(2);
        System.out.println(countString);
    }

}
